package com.sky.controller.user;

import com.sky.entity.Category;
import com.sky.result.Result;
import com.sky.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * PROJECT_NAME: sky-take-out
 * NAME: CategoryController
 *
 * @AUTHOR: zhang
 * DATE: 2023/11/29
 * DESCRIPTION :
 */
@Slf4j
@Api(tags = "C端-分类信息表现层接口") //@Api:用户描述类的相关信息
@RestController("userCategoryController")
@RequestMapping("/user/category")
public class CategoryController {
    @Resource
    private CategoryService categoryService;

    @ApiOperation("查询分类")
    @GetMapping("/list")
    public Result<List<Category>> selectCategoryByType(Integer type){
        log.info("【查询分类】分类类型：{}",type);
        List<Category> categoryList = categoryService.selectCategoryByType(type);
        return Result.success(categoryList);
    }
}
